package com.boss.salary.service.impl;

import com.boss.salary.dao.IExportBankTypeDao;
import com.boss.salary.entity.ExportBankType;
import com.boss.salary.service.IExportBankTypeService;
import com.boss.sys.ca.user.dto.UserDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class ExportBankTypeServicelmpl implements IExportBankTypeService {
    @Autowired
    private IExportBankTypeDao exportBankTypeDao;
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void saveExportBankType(List<ExportBankType> exportBankTypes, UserDTO userDTO) {
       String bankName= exportBankTypes.get(0).getBankType();
        exportBankTypeDao.DeleteExportBankType(bankName,userDTO.getProvince());
        exportBankTypeDao.saveExportBankType(exportBankTypes,userDTO);
    }

    @Override
    public List<ExportBankType> getInfoByPersonTypes(String bankCode, UserDTO userDTO) {
        return exportBankTypeDao.getInfoByPersonTypes(bankCode,userDTO.getProvince());
    }


}
